package Example19;
//定义Animal类
class Animal{
    public  String toString(){
        return "这是动物类";
    }
}
//定义测试
public class Example19 {
    public static void main(String [] args){
        Animal animal = new Animal();          //创建Animal类对象
        System.out.println(animal.toString()); //调用toString()方法并打印
    }
}
